package com.gin.kotlin.no_gay_alliance.model.emoji

import android.os.Parcelable
import com.fasterxml.jackson.annotation.JsonIgnore
import com.gin.nga.response.resource.bbscode.EmoteGroup
import kotlinx.parcelize.Parcelize

/**
 * 通用表情分组
 * @property name 分组名
 * @property author 作者
 * @property data 通用表情数据
 * @constructor
 */
@Parcelize
data class GenericEmojiGroup(
    var name: String? = null,
    var author: String? = null,
    var data: List<GenericEmojiModel>? = null,
    var packageName: String? = null,
) : Parcelable {
    constructor(group: EmojiGroupModel, packageName: String? = null) : this(
        name = group.name,
        author = group.author,
        data = group.data?.map { GenericEmojiModel(it) },
        packageName = packageName,
    )

    constructor(group: EmoteGroup, packageName: String? = null) : this(
        name = group.name,
        author = "NGA",
        data = group.emotes?.map { GenericEmojiModel(it) },
        packageName = packageName,
    )

    /**
     * 唯一名称，用于管理表情包显示
     * @return String
     */
    @JsonIgnore
    fun getUniqueName() = "${packageName}_${name}"
}
